package com.nfc.lock.common.result;

import lombok.Getter;

/**
 * 响应状态码枚举
 */
@Getter
public enum ResultCode {

    SUCCESS(200, "操作成功"),
    ERROR(500, "系统错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "无权限"),
    NOT_FOUND(404, "资源不存在"),
    PARAM_ERROR(400, "参数错误"),

    // 用户相关 2xxx
    USER_NOT_EXIST(2001, "用户不存在"),
    USERNAME_PASSWORD_ERROR(2002, "用户名或密码错误"),
    USERNAME_EXIST(2003, "用户名已存在"),
    TOKEN_EXPIRED(2004, "Token已过期"),
    TOKEN_INVALID(2005, "Token无效"),

    // 区域相关 3xxx
    REGION_NOT_EXIST(3001, "区域不存在"),
    REGION_HAS_CHILDREN(3002, "该区域有下级区域，无法删除"),
    REGION_HAS_ROOMS(3003, "该区域有配电室，无法删除"),

    // 锁具相关 4xxx
    LOCK_NOT_EXIST(4001, "锁具不存在"),
    LOCK_NFC_ID_EXIST(4002, "NFC ID已存在"),
    LOCK_ALREADY_OPEN(4003, "锁具已经是开启状态"),
    LOCK_ALREADY_CLOSED(4004, "锁具已经是关闭状态"),
    LOCK_DAMAGED(4005, "锁具已损坏，无法操作"),

    // 配电室相关 5xxx
    ROOM_NOT_EXIST(5001, "配电室不存在"),
    ROOM_HAS_LOCKS(5002, "配电室有绑定锁具，无法删除");

    private final Integer code;
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
